﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TasksModel
{
    [System.ServiceModel.ServiceContractAttribute(Namespace = "http://mp.tasks.com/2010/")]
    public interface ITasksService
    {
        /// <summary>
        /// Return version of library running.
        /// </summary>
        /// <returns>version a.b.c.d</returns>
        [System.ServiceModel.OperationContractAttribute(Action = "http://mp.tasks.com/2010/Ping", ReplyAction = "*")]
        [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)]
        string Ping();

        /// <summary>
        /// Get list of libraries
        /// </summary>
        /// <returns>[guid|CreatedBy]</returns>
        [System.ServiceModel.OperationContractAttribute(Action = "http://mp.tasks.com/2010/GetLibraries", ReplyAction = "*")]
        [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)]
        List<string> GetLibraries();
        
        /// <summary>
        /// Retrieve library from service.
        /// </summary>
        /// <param name="guid"></param>
        /// <returns>xml, current version or null if not exist</returns>
        [System.ServiceModel.OperationContractAttribute(Action = "http://mp.tasks.com/2010/GetLibrary", ReplyAction = "*")]
        [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)]
        string GetLibrary(string guid);

        /// <summary>
        /// Synchronize changes with library (or create new one).
        /// </summary>
        /// <param name="xml">xml form of library to save</param>
        /// <returns>xml, current/new version</returns>
        [System.ServiceModel.OperationContractAttribute(Action = "http://mp.tasks.com/2010/SaveLibrary", ReplyAction = "*")]
        [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)]
        string SaveLibrary(string xml);
    }
}